#include "IISBack.h"


int main( int argc ,  char * argv[] )
{

	if( argc<3 ){
		ShowUsage( );
	}
	else{
		TCHAR ConfigFile[ 1024 ];
		ZeroMemory( ConfigFile , 1024 );
		MultiByteToWideChar( CP_ACP , 0 , argv[2] , strlen(argv[2]) , ConfigFile , 1024 );

		if( ! strcmp( argv[1] , "/backup" ) ){
			printf( "Backup IIS to %s\n" , argv[2] );
			BackupIIS( ConfigFile );
		}
		else if( !strcmp( argv[1] , "/recover" ) ){
			printf( "Restore IIS from %s\n" , argv[2] );
			RestoreIIS( ConfigFile , false );
		}
		else if( !strcmp(argv[1] , "/autorecover" ) ){
			printf( "Restore IIS with Auto Users from %s\n" , argv[2] );
			RestoreIIS( ConfigFile , true );
		}
		else{
			ShowUsage( );
		}
	}
	return 0;
}